#include "dialog.h"
#include <QLabel>
#include <QPushButton>
#include <QHBoxLayout>

Dialog::Dialog(QWidget *parent)
    :QDialog(parent)
{
    QLabel *label = new QLabel("这是一个对话框",this);
    QPushButton *but = new QPushButton("关闭",this);
    QHBoxLayout *out = new QHBoxLayout(this);
    this->setLayout(out);
    out->addWidget(label);
    out->addWidget(but);

    connect(but,&QPushButton::clicked,this,&Dialog::handle);
}

void Dialog::handle()
{
    this->close();
}


